<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="项目代码" prop="projectCode">
        <el-input v-model="queryParams.projectCode" placeholder="请输入项目代码" clearable size="small"
          @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="项目名称" prop="projectName">
        <el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable size="small"
          @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="创建日期">
        <el-date-picker v-model="dateRange" size="small" style="width: 240px"
          value-format="yyyy-MM-dd" type="daterange" range-separator="-"
          start-placeholder="开始日期" end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="项目类别" prop="projectClassify">
        <el-select v-model="queryParams.projectClassify" placeholder="项目类别" @clear="clearProjectClassify" clearable size="small">
          <el-option v-for="dict in projectClassifyOptions"
            :key="dict.code"
            :label="dict.name"
            :value="dict.code"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="项目状态" prop="projectStatus">
        <el-select v-model="queryParams.projectStatus" placeholder="项目状态" @clear="clearProjectStatus" clearable size="small">
          <el-option v-for="dict in projectStatusOptions"
            :key="dict.code"
            :label="dict.name"
            :value="dict.code"
          />
        </el-select>
      </el-form-item>
      <el-form-item style="margin-left: 10px;">
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" style="margin-left: 10px;">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-plus" size="mini"
          @click="handleAddArmy"
        >军民机立项</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-plus" size="mini"
          @click="handleAddIndustry"
        >行业线立项</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" icon="el-icon-edit" size="mini" :disabled="single"
          @click="handleUpdate"
        >项目变更</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="single"
          @click="handleCancel"
        >项目取消</el-button>
      </el-col>
      <!--<el-col :span="1.5">
        <el-button type="success" icon="el-icon-edit" size="mini" :disabled="single"
          @click="handleEdit"
        >编辑</el-button>
      </el-col>-->
      <!--<el-col :span="1.5">
        <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple"
          @click="handleDelete"
        >删除</el-button>
      </el-col>-->
      <el-col :span="1.5">
        <el-button type="info" icon="el-icon-upload2" size="mini"
          @click="handleImport" v-hasPermi="['system:user:import']"
        >导入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" icon="el-icon-download" size="mini"
          @click="handleExport" v-hasPermi="['system:user:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

<!--    max-height="400" -->
    <el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="序号" align="center" type="index" :show-overflow-tooltip="false"/>
      <el-table-column label="项目代码" align="center" prop="projectCode" :show-overflow-tooltip="true"/>
      <el-table-column label="项目名称" align="center" prop="projectName" :show-overflow-tooltip="true"/>
      <el-table-column label="复核期(年)" align="center" prop="reviewPeriod"/>
      <el-table-column label="培训大纲" align="center" prop="outline"
                       :show-overflow-tooltip="true" :formatter="outlineStatusFormat"/>
      <el-table-column label="培训教材" align="center" prop="textbook"
                       :show-overflow-tooltip="true" :formatter="textbookStatusFormat"/>
      <!--<el-table-column label="颁证机构" align="center" prop="institution"
                       :show-overflow-tooltip="true" :formatter="institutionStatusFormat"/>-->
      <el-table-column label="颁证机构" align="center" prop="institutionName" :show-overflow-tooltip="true"/>
      <el-table-column label="创建日期" align="center" width="100px" prop="creationDate">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.creationDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="项目类别" align="center" prop="projectClassify" :formatter="projectClassifyFormat"/>
      <el-table-column label="项目状态" align="center" prop="projectStatus"  :formatter="projectStatusFormat"/>
      <el-table-column label="流程状态" align="center" prop="processStatus"  :formatter="processStatusFormat"/>
    <!--  <el-table-column
        label="流程状态"
        align="center"
        prop="actBusinessStatus.status"
        :formatter="actStatusFormat"/>-->
      <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-view"
                  @click="handleView(scope.row)"
          >详情</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit"
                     v-if="scope.row.projectStatus === '0' && !scope.row.processStatus"
                     @click="handleEdit(scope.row)"
          >修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete"
                     v-if="scope.row.projectStatus === '0' && !scope.row.processStatus"
                     @click="handleDelete(scope.row)"
          >删除</el-button>
          <!--<el-button v-if="scope.row.actBusinessStatus.status==='waiting'"
            size="mini" type="text" icon="el-icon-back"
            @click="cancelProcessApply(scope.row)"
          >撤销</el-button>-->
        </template>
      </el-table-column>
    </el-table>

    <pagination
            v-show="total>0"
            :total="total"
            :page.sync="pageParams.page"
            :limit.sync="pageParams.rows"
            @pagination="getList"
    />

    <!-- 添加或修改军民机业务对话框 -->
    <el-dialog :title="title" :visible.sync="open" v-if="open" width="800px" append-to-body>
      <el-tabs>
        <el-tab-pane label="业务单据" v-loading="loading">
          <el-form ref="form" :model="form" :rules="rules"  label-width="120px">
            <el-form-item label="申请项目名称" prop="projectName">
              <el-input v-model="form.projectName" placeholder="请输入申请项目名称" :disabled="disabled2"/>
            </el-form-item>
            <el-form-item label="适用项目" prop="applyProject">
              <el-radio-group v-model="form.applyProject">
                <el-radio v-for="dict in applyProjectOptions"
                          :disabled="disabled"
                          :label="dict.code"
                          :key="dict.code">
                  {{dict.name}}
                </el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="适用单位" prop="applyUnit">
              <el-checkbox-group v-model="applyUnit">
                <el-checkbox v-for="applyUnit in applyUnitOptions"
                             :disabled="disabled"
                             :label="applyUnit"
                             :key="applyUnit">
                  {{applyUnit}}
                </el-checkbox>
              </el-checkbox-group>
            </el-form-item>
            <el-form-item label="适用员工" prop="applyStaff">
              <el-checkbox-group v-model="applyStaff">
                <el-checkbox v-for="applyStaff in applyStaffOptions"
                             :disabled="disabled"
                             :label="applyStaff"
                             :key="applyStaff">
                  {{applyStaff}}
                </el-checkbox>
              </el-checkbox-group>
            </el-form-item>
            <el-form-item label="视力要求" prop="vision" style="margin-top: 5px">
              <el-input v-model="form.vision" :disabled="disabled" placeholder="请输入视力要求"/>
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="视力复核(年)"  prop="visionReview" >
                  <el-input-number v-model="form.visionReview"
                    controls-position="right" :min="0"
                    placeholder="请输入复核年限" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="复核期(年)" prop="reviewPeriod" >
                  <el-input-number v-model="form.reviewPeriod"
                    controls-position="right" :min="0" :max="10"
                    placeholder="请输入复核期,单位:年" :disabled="disabled2"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="文件要求">
              <el-form-item prop="fileSpecification">
                <el-input v-model="form.fileSpecification"
                  type="textarea" placeholder="请输入申报文件要求内容"
                />
              </el-form-item>
            </el-form-item>
            <el-form-item label="其他要求">
              <el-form-item prop="otherReasons" style="margin-top: 5px">
                <el-input v-model="form.otherReasons" type="textarea" placeholder="请输入申报其他要求内容"/>
              </el-form-item>
            </el-form-item>

            <el-row>
              <el-col :span="12">
                <el-form-item label="培训大纲" prop="outline">
                  <el-radio-group v-model="form.outline">
                    <el-radio v-for="dict in outlineStatusOptions" :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="培训教材" prop="textbook">
                  <el-radio-group v-model="form.textbook">
                    <el-radio v-for="dict in textbookStatusOptions" :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="颁证机构" prop="institution">
                  <el-radio-group v-model="form.institution">
                    <el-radio v-for="dict in institutionStatusOptions" :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code"
                              @change="bindInstitutionName(dict.code)">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="机构名称" prop="institutionName">
                  <el-input v-model="form.institutionName" :disabled="disabled"
                            placeholder="请输入机构名称" style="width: 72%;"/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="民机取证类型" prop="civilAircraftCert">
                  <el-radio-group v-model="form.civilAircraftCert">
                    <el-radio v-for="dict in civilStatusOptions" :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="清册标识" prop="bookTag">
                  <el-select v-model="form.bookTag"  placeholder="清册标识" :disabled="disabled" clearable size="small">
                    <el-option v-for="dict in bookTagOptions"
                      :key="dict.code"
                      :label="dict.name"
                      :value="dict.code"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="其他要求">
              <el-form-item prop="otherCause" style="margin-top: 5px">
                <el-input v-model="form.otherCause"
                  type="textarea"
                  placeholder="请输入其他要求内容"
                  :disabled="disabled"
                />
              </el-form-item>
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="检验检测员取证" prop="checkoutIsCert">
                  <el-radio-group v-model="form.checkoutIsCert">
                    <el-radio v-for="dict in checkOutStatusOptions" :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="准考证" prop="admissionTicket">
                  <el-radio-group v-model="form.admissionTicket">
                    <el-radio v-for="dict in admissionTicketOptions" :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="理论合格分数" prop="theoryQualified">
                  <el-input-number v-model="form.theoryQualified"
                    controls-position="right" :min="0" :max="150"
                    placeholder="请输入理论合格分数" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="实操合格分数"  prop="practicalQualified">
                  <el-input-number v-model="form.practicalQualified"
                    controls-position="right" :min="0" :max="150"
                    placeholder="请输入实操合格分数" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="理论总分数"  prop="theoryTotal">
                  <el-input-number v-model="form.theoryTotal"
                    controls-position="right" :min="0" :max="150"
                    placeholder="请输入理论总分数" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="考试时长" prop="theoryDuration">
                  <el-input-number v-model="form.theoryDuration"
                    controls-position="right" :min="0" :max="180"
                    placeholder="请输入考试时长(分钟)" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="补考间隔" prop="makeUpInterval">
                  <el-input-number v-model="form.makeUpInterval"
                    controls-position="right" :min="0" :max="90"
                    placeholder="请输入补考间隔(天)" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="补考次数" prop="makeUpNumber">
                  <el-input-number v-model="form.makeUpNumber"
                    controls-position="right" :min="0" :max="5"
                    placeholder="请输入补考次数" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="" prop="assessType">
              <el-checkbox v-model="form.assessType" :disabled="disabled" label="0">参与矩阵评估</el-checkbox>
            </el-form-item>

            <el-form-item prop="projectClassify" label="军民机立项标识" style="margin-top: 5px" hidden>
              <el-input v-model="form.projectClassify=0"/>
            </el-form-item>
            <el-form-item prop="submitTag" label="军民机操作流程标识" style="margin-top: 5px" hidden>
              <el-input v-model="form.submitTag"/>
            </el-form-item>
          </el-form>
          <div class="dialog-footer" style="float:right" v-if="flag">
            <el-button :loading="buttonLoading" v-if="hideBtn" type="info" @click="submitForm('zancun')">暂存</el-button>
            <el-button :loading="buttonLoading" type="primary" @click="submitForm('submit')">提交</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
          <div class="dialog-footer" style="float:right" v-if="!flag">
            <el-button @click="cancel">关 闭</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="流程进度" v-if="openHistory">
          <el-table :data="historyInfoList" border stripe style="width: 100%" max-height="300">
            <el-table-column label="流程审批历史记录" align="center">
              <el-table-column type="index" label="序号" align="center" width="50"></el-table-column>
              <el-table-column prop="NodeName" label="任务名称" align="center"></el-table-column>
              <el-table-column prop="UserName" label="处理人" align="center"></el-table-column>
              <el-table-column prop="ActionName" label="状态" align="center"></el-table-column>
              <el-table-column prop="Remark" label="审批意见" align="center"></el-table-column>
              <el-table-column prop="StartTime" label="开始时间" align="center"></el-table-column>
              <el-table-column prop="EndTime" label="结束时间" align="center"></el-table-column>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="流程图" v-if="openHistory">
          <div style="height: 877px;" >
            <iframe :src="iframeUrl"
                    scrolling="no" frameborder="0" style="display: block; height: 100%; width: 100%;"></iframe>
          </div>
        </el-tab-pane>
        <!-- 审批历史 -->
        <!--<el-tab-pane label="审批历史" v-if="processInstanceId">
          <history ref="historyRef" :processInstanceId="processInstanceId"></history>
        </el-tab-pane>
        <el-tab-pane label="流程状态" v-if="processInstanceId">
          <diagram ref="diagramRef" :processInstanceId="processInstanceId"></diagram>
        </el-tab-pane>-->
      </el-tabs>
    </el-dialog>

    <!-- 添加或修改行业线业务对话框 -->
    <el-dialog :title="title" :visible.sync="openIndustry" v-if="openIndustry" width="800px" append-to-body>
      <el-tabs>
        <el-tab-pane label="业务单据" v-loading="loading">
          <el-form ref="form" :model="form" :rules="rules" label-width="120px">
            <el-form-item label="申请项目名称" prop="projectName">
              <el-input v-model="form.projectName"
                placeholder="请输入申请项目名称" :disabled="disabled2"
              />
            </el-form-item>

            <el-form-item label="专业" prop="specialtyId">
              <treeselect v-model="form.specialtyId" :options="specialtyOptions"
                :normalizer="normalizer" :show-count="true"
                placeholder="选择专业" :disabled="disabled"
              ></treeselect>
            </el-form-item>

            <el-row>
              <el-col :span="12">
                <el-form-item label="复核期(年)" prop="reviewPeriod">
                  <el-input-number v-model="form.reviewPeriod"
                    controls-position="right" :min="0" :max="10"
                    placeholder="请输入复核期,单位:年" :disabled="disabled2"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="清册标识" prop="bookTag">
                  <el-select v-model="form.bookTag"  placeholder="清册标识" :disabled="disabled" clearable size="small">
                    <el-option v-for="dict in bookTagOptions"
                      :key="dict.code"
                      :label="dict.name"
                      :value="dict.code"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="12">
                <el-form-item label="类别" prop="projectCategory">
                  <el-radio-group v-model="form.projectCategory">
                    <el-radio v-for="dict in categoryStatusOptions"
                              :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="准考证" prop="admissionTicket">
                  <el-radio-group v-model="form.admissionTicket">
                    <el-radio v-for="dict in admissionTicketOptions"
                              :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>

            <el-form-item label="适用员工" prop="applyStaff">
              <el-checkbox-group v-model="applyStaff">
                <el-checkbox v-for="applyStaff in industryApplyStaffOptions"
                             :disabled="disabled"
                             :label="applyStaff"
                             :key="applyStaff">
                  {{applyStaff}}
                </el-checkbox>
              </el-checkbox-group>
            </el-form-item>
            <el-form-item label="文件要求">
              <el-form-item prop="fileSpecification">
                <el-input v-model="form.fileSpecification" type="textarea" placeholder="请输入申报文件要求内容"/>
              </el-form-item>
            </el-form-item>

            <el-form-item label="其他要求">
              <el-form-item prop="otherReasons" style="margin-top: 5px">
                <el-input v-model="form.otherReasons" type="textarea" placeholder="请输入申报其他要求内容"/>
              </el-form-item>
            </el-form-item>

            <el-row>
              <el-col :span="12">
                <el-form-item label="培训大纲" prop="outline">
                  <el-radio-group v-model="form.outline">
                    <el-radio v-for="dict in outlineStatusOptions"
                              :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="培训教材" prop="textbook">
                  <el-radio-group v-model="form.textbook">
                    <el-radio v-for="dict in textbookStatusOptions"
                              :disabled="disabled"
                              :label="dict.code"
                              :key="dict.code">
                      {{dict.name}}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="从业年限" prop="ageLimit">
              <el-radio-group v-model="form.ageLimit">
                <el-radio v-for="dict in ageStatusOptions"
                          :disabled="disabled"
                          :label="dict.code"
                          :key="dict.code">
                  {{dict.name}}
                </el-radio>
              </el-radio-group>
            </el-form-item>
            <el-row>
              <el-col :span="12">
                <el-form-item label="理论合格分数" prop="theoryQualified">
                  <el-input-number v-model="form.theoryQualified"
                    controls-position="right" :min="0" :max="150"
                    placeholder="请输入理论合格分数" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="实操合格分数"  prop="practicalQualified">
                  <el-input-number v-model="form.practicalQualified"
                    controls-position="right"  :min="0" :max="150"
                    placeholder="请输入实操合格分数" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="理论总分数"  prop="theoryTotal">
                  <el-input-number v-model="form.theoryTotal"
                    controls-position="right" :min="0" :max="150"
                    placeholder="请输入理论总分数" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="考试时长" prop="theoryDuration">
                  <el-input-number v-model="form.theoryDuration"
                    controls-position="right" :min="0" :max="180"
                    placeholder="请输入考试时长(分钟)" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="补考间隔" prop="makeUpInterval">
                  <el-input-number v-model="form.makeUpInterval"
                    controls-position="right" :min="0" :max="90"
                    placeholder="请输入补考间隔(天)" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="补考次数" prop="makeUpNumber">
                  <el-input-number v-model="form.makeUpNumber"
                    controls-position="right" :min="0" :max="5"
                    placeholder="请输入补考次数" :disabled="disabled"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item prop="projectClassify" label="行业线立项标识" style="margin-top: 5px" hidden>
              <el-input v-model="form.projectClassify=1"/>
            </el-form-item>
            <el-form-item prop="submitTag" label="行业线操作流程标识" style="margin-top: 5px" hidden >
              <el-input v-model="form.submitTag"/>
            </el-form-item>
          </el-form>
          <div class="dialog-footer" style="float:right" v-if="flag">
            <el-button :loading="buttonLoading" v-if="hideBtn" type="info" @click="submitForm('zancun')">暂存</el-button>
            <el-button :loading="buttonLoading" type="primary" @click="submitForm('submit')">提交</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
          <div class="dialog-footer" style="float:right" v-if="!flag">
            <el-button @click="cancel">关 闭</el-button>
          </div>
        </el-tab-pane>
        <!-- 审批历史 -->
        <!--<el-tab-pane label="审批历史" v-if="processInstanceId">
          <history ref="historyRef" :processInstanceId="processInstanceId"></history>
        </el-tab-pane>
        <el-tab-pane label="流程状态" v-if="processInstanceId">
          <diagram ref="diagramRef" :processInstanceId="processInstanceId"></diagram>
        </el-tab-pane>-->
      </el-tabs>
    </el-dialog>

    <!-- 提交审批 -->
    <el-dialog title="提交审批" v-if="openVerify" :visible.sync="openVerify" width="700px" append-to-body>
      <verify ref="verify" :process-status="processStatus" @closeVerify="closeVerify"></verify>
    </el-dialog>
    <!-- 提交 -->
    <!--<verify ref="verifyRef" @callSubmit="callSubmit" :taskId="taskId" :taskVariables="taskVariables"
            :sendMessage="sendMessage"></verify>-->
    <!-- 项目导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload ref="upload" :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div class="el-upload__tip" slot="tip">
          <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
        </div>
        <div class="el-upload__tip" style="color:red" slot="tip">提示：仅允许导入“xls”或“xlsx”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
  import Treeselect from "@riophae/vue-treeselect";
  import {getToken} from "@/utils/auth";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  import {
    listProjectInfo,
    getProjectByProjectId,
    addProject,
    updateProject,
    delProject
  } from "@/api/question/projectInfo";
  import {listSpecialty,} from "@/api/question/specialtyTree";
  import verify from "@/views/workflow/components/Verify";
  import {historyInfoList, getToDoTaskList, getProcessInstanceListByBusinessId} from "@/api/workflow/workFlow";
  import {getuserCode} from "@/utils/userCode";

  // import { getNodeUserList } from "@/api/workflow/workFlow";
  // import { getuserCode } from "@/utils/userCode";

  //适用单位
  const applyUnitOptions = ['总装', '部装', '试飞', '检验检测'];
  //适用员工
  const applyStaffOptions = ['操作', '检验', '技术', '管理', '专业/专制', '非专业/兼职'];
  const industryApplyStaffOptions = ['工艺员', '工艺师', '培训员', '宣传干事'];
  export default {
    name: "projectInfo",
    components: {
      Treeselect,
      verify
    },
    data() {
      return {
        // 流程状态（0：启动流程，1：流程流转）
        processStatus: '0',
        // 流程实例
        processInstanceId: '',
        // 按钮loading
        buttonLoading: false,
        // 暂存按钮是否显示
        hideBtn: true,
        // 遮罩层
        loading: true,
        // 禁用除复核期和项目名称外表单信息
        disabled: false,
        // 禁用复核期和项目名称
        disabled2: false,
        // 选中数组
        ids: [],
        // 选中项目代码数组
        projectCodes: [],
        // 业务状态
        actBusinessStatus: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 项目表格数据
        projectList: [],
        // 弹出层标题
        title: "",
        // 适用项目
        applyProjectOptions: [],
        //适用单位
        applyUnitOptions: applyUnitOptions,
        applyUnit: [],
        //适用员工
        applyStaffOptions: applyStaffOptions,
        //行业线适用员工
        industryApplyStaffOptions: industryApplyStaffOptions,
        applyStaff: [],
        // 是否显示军民机立项弹出层
        open: false,
        // 是否显示行业线立项弹出层
        openIndustry: false,
        // 提交审批开关
        openVerify: false,
        // 项目类别数据字典
        projectClassifyOptions: [],
        // 项目状态数据字典
        projectStatusOptions: [],
        // 培训大纲数据字典
        outlineStatusOptions: [],
        // 培训教材数据字典
        textbookStatusOptions: [],
        // 颁证机构数据字典
        institutionStatusOptions: [],
        // 民机取证类型数据字典
        civilStatusOptions: [],
        // 检验检测是否取证
        checkOutStatusOptions: [],
        // 准考证类型数据字典
        admissionTicketOptions: [],
        // 清册标识数据字典
        bookTagOptions: [],
        // 行业线立项类别数据字典
        categoryStatusOptions: [],
        // 从业年限数据字典
        ageStatusOptions: [],
        //流程字典状态
        actStatusOptions: [],
        // 日期范围
        dateRange: [],
        //行业线立项专业树选项
        specialtyOptions: [],
        // 流程历史记录
        historyInfoList: [],
        // 历史记录开关
        openHistory: false,
        // 流程图
        iframeUrl: undefined,
        // 项目导入参数
        upload: {
          // 是否显示弹出层（项目导入）
          open: false,
          // 弹出层标题（项目导入）
          title: "",
          // 是否禁用上传
          isUploading: false,
          // 是否更新已经存在的项目数据
          updateSupport: 0,
          // 设置上传的请求头部
          headers: {Authorization: "Bearer " + getToken()},
          // 上传的地址
          url: process.env.VUE_APP_BASE_API + "/exam/project/importData"
        },
        // 分页参数
        pageParams: {
          page: 1,
          rows: 10,
        },
        // 查询参数
        queryParams: {
          projectCode: undefined,
          projectName: undefined,
          projectClassify: undefined,
          projectStatus: undefined,
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {
          projectName: [
            {required: true, message: "项目名称不能为空", trigger: "blur"}
          ],
          reviewPeriod: [
            {required: true, message: "复核期,单位:年,不能为空", trigger: "blur"}
          ],
          applyProject: [
            {required: true, message: "请选择适用项目", trigger: "blur"}
          ],
          specialtyId: [
            {required: true, message: "请选择专业", trigger: "blur"}
          ],
          outline: [
            {required: true, message: "请选择培训大纲", trigger: "change"}
          ],
          textbook: [
            {required: true, message: "请选择培训教材", trigger: "blur"}
          ],
          institution: [
            {required: true, message: "请选择颁证机构", trigger: "blur"}
          ],
          institutionName: [
            {required: true, message: "请输入机构名称", trigger: "blur"}
          ],
          checkoutIsCert: [
            {required: true, message: "检验检测员是否取证", trigger: "blur"}
          ],
          admissionTicket: [
            {required: true, message: "请选择准考证类型", trigger: "blur"}
          ],
          projectCategory:[
            {required: true, message: "请选择类别！", trigger: "blur"}
          ],
          bookTag: [
            {required: true, message: "请选择清册标识！", trigger: "blur"}
          ],
          theoryQualified: [
            {required: true, message: "请输入理论合格分数", trigger: "blur"}
          ],
          theoryTotal: [
            {required: true, message: "请输入理论总分数", trigger: "blur"}
          ],
          theoryDuration: [
            {required: true, message: "请输入理论考试时长", trigger: "blur"}
          ],
          ageLimit: [
            {required: true, message: "请选择从业年限", trigger: "blur"}
          ],

        },
        // taskVariables: {}, //流程变量
        // taskId: undefined, //任务id
        flag: true,
        // 消息提醒
        sendMessage: {}
      };
    },
    created() {
      //查询 项目类别字典状态
      this.getDicts("question_project_classify").then(response => {
        this.projectClassifyOptions = response.responseBody.result;
      });
      //查询项目状态字典状态
      this.getDicts("question_project_status").then(response => {
        this.projectStatusOptions = response.responseBody.result;
      });
      //查询培训大纲字典状态
      this.getDicts("question_project_outline").then(response => {
        this.outlineStatusOptions = response.responseBody.result;
      });
      //查询培训教材字典状态
      this.getDicts("question_project_textbook").then(response => {
        this.textbookStatusOptions = response.responseBody.result;
      });
      //查询颁证机构字典状态
      this.getDicts("question_project_institution").then(response => {
        this.institutionStatusOptions = response.responseBody.result;
      });
      //查询检验检测是否取证状态
      this.getDicts("question_project_checkout").then(response => {
        this.checkOutStatusOptions = response.responseBody.result;
      });
      //查询准考证类型数据状态
      this.getDicts("question_project_admission").then(response => {
        this.admissionTicketOptions = response.responseBody.result;
      });
      //查询清册标识数据状态
      this.getDicts("exam_book_tag").then(response => {
        this.bookTagOptions = response.responseBody.result;
      });
      // 查询流程字典状态
     /* this.getDicts("act_status").then(response => {
        this.actStatusOptions = response.responseBody.result;
      });*/
      //查询适用项目字典
      this.getDicts("Q00001").then(response => {
        this.applyProjectOptions = response.responseBody.result;
      });
      //查询民机取证类型字典状态
      this.getDicts("question_project_civil").then(response => {
        this.civilStatusOptions = response.responseBody.result;
      });
      //查询行业线立项类别状态
      this.getDicts("question_project_category").then(response => {
        this.categoryStatusOptions = response.responseBody.result;
      });
      //查询从业年限字典状态
      this.getDicts("question_project_age").then(response => {
        this.ageStatusOptions = response.responseBody.result;
      });
      this.getList();
      // 获取专业树结构
      this.getTreeSelect();
    },
    methods: {
      /** 查询项目列表 */
      getList() {
        this.loading = true;
        listProjectInfo({
                  'pageParameter': this.pageParams,
                  'searchParams': this.addDateRange(this.queryParams, this.dateRange)
        }).then(response => {
          const result = response.responseBody.result
          const total =  response.responseBody.pageParameter.totalCount
          const searchParams = []
          result.forEach(item => {
            searchParams.push({
              "businessId": item.projectId
            })
          })
          // 根据业务id查询流程实例
          getProcessInstanceListByBusinessId(searchParams).then(resp => {
            const processInstanceList = resp.responseBody
            // 将流程实例状态回填至对应记录
            for (let i = 0; i < result.length; i++) {
              for (let j = 0; j < processInstanceList.length; j++) {
                if (result[i].projectId === processInstanceList[j].businessId) {
                  result[i].processStatus = processInstanceList[j].processStatus
                }
              }
            }
            this.projectList = result
            this.total = total
            this.loading = false
          })
        });
      },
      /** 颁证机构绑定 */
      bindInstitutionName(code) {
        // console.log("颁证机构类型：", code);
        // 0: 内部颁证
        if ("0" === code) {
          this.form.institutionName = '培训中心';
          return;
        }
        this.form.institutionName = null;
      },

      /** 转换专业树数据结构 */
      normalizer(node) {
        if (node.children && !node.children.length) {
          delete node.children;
        }
        return {
          id: node.specialtyId,
          label: node.specialtyName,
          children: node.children
        };
      },
      //查询专业树结构
      getTreeSelect(){
        listSpecialty({'searchParams': {}}).then(response => {
          const specialty = {specialtyId: 0,specialtyName: "主类目", children: []};
          specialty.children = this.handleTree(response.responseBody.result,"specialtyId");
          this.specialtyOptions.push(specialty);
        })
      },
      // 项目类别字典翻译
      projectClassifyFormat(row, column) {
        return this.selectDictLabel(this.projectClassifyOptions, row.projectClassify);
      },
      // 项目状态字典翻译
      projectStatusFormat(row, column) {
        return this.selectDictLabel(this.projectStatusOptions, row.projectStatus);
      },

      // 流程状态回显
      processStatusFormat (row, column) {
        return row.processStatus === '0' ? '草稿' :
            (row.processStatus === '1' ? '处理中' : (row.processStatus === '2' ? '结束' : '未发起'))
      },

      // 培训大纲字典翻译
      outlineStatusFormat(row, column) {
        return this.selectDictLabel(this.outlineStatusOptions, row.outline);
      },
      // 培训教材字典翻译
      textbookStatusFormat(row, column) {
        return this.selectDictLabel(this.textbookStatusOptions, row.textbook);
      },
      // 颁证机构字典翻译
      institutionStatusFormat(row, column) {
        return this.selectDictLabel(this.institutionStatusOptions, row.institution);
      },
      // 流程状态字典翻译
      actStatusFormat(row, column) {
        return this.selectDictLabel(this.actStatusOptions, row.actBusinessStatus.status);
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.openIndustry = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          projectCode: undefined,
          projectName: undefined,
          reviewPeriod: undefined,
          vision: undefined,
          visionReview: undefined,
          fileSpecification: undefined,
          otherReasons: undefined,
          institutionName: undefined,
          otherCause: undefined,
          projectClassify: undefined,
          projectStatus: undefined,
        };
        this.applyUnit = [],
        this.applyStaff = [],
        this.processInstanceId = undefined
        this.resetForm("form");
      },
      /** 清空搜索项目类别 */
      clearProjectClassify(val) {
        this.queryParams.projectClassify = undefined;
      },
      /** 清空搜索项目状态 */
      clearProjectStatus(val) {
        this.queryParams.projectStatus = undefined;
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.pageParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.dateRange = [];
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.projectId)
        this.projectCodes = selection.map(item => item.projectCode)
        this.single = selection.length != 1
        this.multiple = !selection.length
      },
      /** 新增军民机立项按钮操作 */
      handleAddArmy() {
        // 除项目名称和复核期外其余属性均可读写
        this.disabled = false;
        //项目名称和复核期属性均可读写
        this.disabled2 = false;
        // 暂存按钮显示
        this.hideBtn = true;
        this.flag = true
        this.reset();
        this.open = true;
        this.title = "添加军民机立项业务";
      },
      /** 新增行业线立项按钮操作 */
      handleAddIndustry() {
        // 除项目名称和复核期外其余属性均可读写
        this.disabled = false;
        //项目名称和复核期属性均可读写
        this.disabled2 = false;
        // 暂存按钮显示
        this.hideBtn = true;
        this.flag = true
        this.reset();
        this.openIndustry = true;
        this.title = "添加行业线立项业务";
      },
      /** 提交按钮 */
      submitForm(flag) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            // 立项操作流程标识 0:新增操作，1：变更操作，2，取消操作
            this.form.submitTag = this.form.submitTag == null ? '0' : this.form.submitTag;
            // 是否参与矩阵评估 0：参与 1：不参与
            this.form.assessType = this.form.assessType == true ? 0 : 1;
            // 适应单位
            this.form.applyUnit = this.applyUnit !== null ? this.applyUnit.toString() : null;
            // 适应项目
            this.form.applyStaff = this.applyStaff !== null ? this.applyStaff.toString() : null;
            // 状态 0：暂存；1：已发布
            this.form.projectStatus = '0';
            // 获取清册标识对应代码
            for (const index in  this.bookTagOptions) {
              if (this.bookTagOptions[index].code === this.form.bookTag) {
                this.form.bookCode = this.bookTagOptions[index].enName;
              }
            }
            this.buttonLoading = true;
            if (this.form.projectId != null) {
              updateProject(this.form).then(response => {
                // this.msgSuccess("修改成功");
                if (flag === 'submit') {
                  this.submitProcess(response.responseBody)
                }
                if (flag === 'zancun') {
                  this.form.projectClassify === 0 ? this.open = false : this.openIndustry = false;
                  this.getList();
                }
              }).finally(() => {
                this.buttonLoading = false;
              });
            } else {
              addProject(this.form).then(response => {
                // this.msgSuccess("新增成功");
                if (flag === 'submit') {
                  this.submitProcess(response.responseBody)
                }
                if (flag === 'zancun') {
                  // 根据项目类别关闭窗口
                  this.form.projectClassify === 0 ? this.open = false : this.openIndustry = false;
                  this.getList();
                }
              }).finally(() => {
                this.buttonLoading = false;
              });
            }
          }
        });
      },
      // 提交成功回调
      callSubmit() {
        this.open = false;
      },
      //提交流程
      submitProcess(entity) {
        const params = {
          processId: '1dd29d980c95204e550b0fd0d4cbe34b03c5', // 流程模型id
          processName: entity.projectClassify == 0 ? '军民机立项流程' : '行业线立项流程', // 流程名
          businessId: entity.projectId, // 业务id
          link: entity.projectClassify == 0 ? 'question/proj' +
              'ectinfo/form/projectArmyForm' : 'question/projectinfo/form/projectIndustryForm',  // 待办表单路径
          formData: JSON.stringify({}),
          url: '/api/uf/boostor/exam/question/ExamProjectInfoRest/updateProjectStatus/v1'
        }
        this.openVerify = true
        // 初始化提交审/-=-
        this.$nextTick(() => {
          this.$refs.verify.init(params);
        })
      },

      closeVerify(){
        this.openVerify = false
        this.$nextTick(() => {
          this.cancel();
          this.getList()
        });
      },
      //撤回
      /*cancelProcessApply(row) {
        this.$confirm('是否撤销申请').then(() => {
          this.loading = true;
          return processAip.cancelProcessApply(row.processInstanceId);
        }).then(() => {
          this.getList();
          this.msgSuccess("撤回成功");
        }).finally(() => {
          this.loading = false;
        });
      },

      /** 变更按钮操作 */
      handleUpdate(row) {
        // 除项目名称和复核期外其余属性均只读
        this.disabled = true;
        //项目名称和复核期属性均可读写
        this.disabled2 = false;
        // 暂存按钮不显示
        this.hideBtn = false;
        this.flag = true
        this.reset();
        const projectIds = row.projectId || this.ids
        getProjectByProjectId(projectIds).then(response => {
          // waiting:流程处理中项目不能更改 1:项目已发布
          if (response.responseBody.projectStatus !== "1" ) {
            this.msgWarning("当前项目不能进行变更！");
            return;
          }
          /*if (response.data.actBusinessStatus.status == 'waiting') {
            this.msgWarning("当前项目不能进行变更！");
            return;
          }*/
          this.loading = false;
          this.form = response.responseBody;
          this.dataType();
          // 更新立项业务流程操作为项目变更 标识：1
          this.form.submitTag = '1';
          /*this.$nextTick(() => {
            this.processInstanceId = response.responseBody.processInstanceId
          })*/
          this.form.projectClassify === "0" ? this.open = true : this.openIndustry = true;
          this.title = "修改立项业务";
          this.sendMessage = {
            title: '立项申报',
            messageContent: '单据【' + row.projectCode + "】申报"
          }
        });
      },
      /** 项目取消按钮操作 */
      handleCancel(row) {
        // 除项目名称和复核期外其余属性均只读
        this.disabled = true;
        //项目名称和复核期属性均只读
        this.disabled2 = true;
        // 暂存按钮不显示
        this.hideBtn = false;
        this.flag = true
        this.reset();
        const projectIds = row.projectId || this.ids
        getProjectByProjectId(projectIds).then(response => {
          // finish：已完成流程标识  1:项目已发布
          if (response.responseBody.projectStatus !== "1" ) {
            this.msgWarning("当前项目不能进行取消！");
            return;
          }
          this.loading = false;
          this.form = response.responseBody;
          this.dataType();
          // 更新立项业务流程操作为取消项目 标识：2
          this.form.submitTag = '2';
          /*this.$nextTick(() => {
            this.processInstanceId = response.responseBody.processInstanceId
          })*/
          this.form.projectClassify === "0" ? this.open = true : this.openIndustry = true;
          this.title = "修改立项业务";
          /*this.sendMessage = {
            title: '立项申报',
            messageContent: '单据【' + row.projectCode + "】申报"
          }*/
        });
      },
      /** 项目编辑按钮操作 */
      async handleEdit(row) {
        // 初始化历史记录
        this.historyInfoList = []
        this.openHistory = false
        this.iframeUrl = undefined
        // 除项目名称和复核期外其余属性均可读写
        this.disabled = false;
        //项目名称和复核期属性均可读写
        this.disabled2 = false;
        // 暂存按钮显示
        this.hideBtn = true;
        this.flag = true
        // this.loading = true;
        this.reset();
        const projectIds = row.projectId || this.ids
        getProjectByProjectId(projectIds).then(response => {
          /*if (response.data.actBusinessStatus.status !== 'draft' && response.data.actBusinessStatus.status !== 'cancel') {
            this.msgWarning("当前项目不能进行编辑！");
            return;
          }*/
          this.loading = false;
          this.form = response.responseBody;
          this.dataType();
          this.form.projectClassify === "0" ? this.open = true : this.openIndustry = true;
          this.title = "修改立项业务";
          /*this.sendMessage = {
            title: '立项申报',
            messageContent: '单据【' + row.projectCode + "】申报"
          }*/
        });

      },
      //详情
      async handleView(row) {
        // 初始化历史记录
        this.historyInfoList = []
        this.openHistory = false
        this.iframeUrl = undefined

        // 除项目名称和复核期外其余属性均只读
        this.disabled = true;
        //项目名称和复核期属性均只读
        this.disabled2 = true;
        this.flag = false
        this.loading = true;
        this.reset();
        const projectIds = row.projectId || this.ids
        await getProjectByProjectId(projectIds).then(response => {
          this.loading = false;
          this.form = response.responseBody;
          this.dataType();
        });
        // 存在流程的记录才能查看流程信息
        if(row.processStatus){
          // 根据用户id及业务id查询流程实例id
          let todoTaskList
          await getToDoTaskList({userId: getuserCode(), businessId: row.projectId}).then(resp => {
            todoTaskList = resp
          })
          // 根据流程实例id查询流程历史记录
          const { responseBody } = await historyInfoList({"docUnid":todoTaskList[0].docUnid});
          this.historyInfoList = responseBody.rows;
          this.iframeUrl = "http://188.188.10.38:8080/osbpm/rule?wf_num=R_S003_B068&Processid=" + todoTaskList[0].processId + "&DocUnid=" + todoTaskList[0].docUnid;
          this.openHistory = true
        }
        this.form.projectClassify === "0" ? this.open = true : this.openIndustry = true;
        this.title = "查看立项业务";
      },
      // 数据类型转换
      dataType() {
        this.applyUnit = this.form.applyUnit !== null ? this.form.applyUnit.split(',') : this.applyUnit;
        this.applyStaff = this.form.applyStaff !== null ? this.form.applyStaff.split(',') : this.applyStaff;
        this.form.assessType = this.form.assessType == "0" ? true : false;
        this.$nextTick(() => {
          this.processInstanceId = this.form.processInstanceId
        })
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        // console.log("====",JSON.stringify(row));
        const projectCodes = row.projectCode || this.projectCodes;
        // 批量删除时检查项目业务状态 draft cancel
       /* var businessStatus = this.actBusinessStatus;
        const c = businessStatus === null ? false : true;
        if (c) {
          businessStatus = businessStatus.splice(',');
          for (let lengthKey in businessStatus) {
            // console.log("====="+businessStatus[lengthKey]);
            if (businessStatus[lengthKey] !== 'draft' && businessStatus[lengthKey] !== 'cancel') {
              this.msgError('项目代码为' + projectCodes[lengthKey] + '"的数据项不能删除！');
              return;
            }
          }
        }*/
        this.$confirm('确认删除项目代码为"' + projectCodes + '"的数据项？','提示',{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: "warning"
        }).then(() => {
          this.loading = true;
          delProject(projectCodes).then(response => {
            this.msgSuccess("删除成功");
            this.loading = false;
            this.getList();
          })
        }).catch(() => {
        }).finally(() => {
          this.loading = false;
        });
      },
      /** 导出按钮操作 */
      handleExport() {
        this.msgWarning("项目导出待开发。。。");
      },
      /** 导入按钮操作 */
      handleImport() {
        this.msgWarning("项目导入待开发。。。");
        /*this.upload.title = "项目导入";
        this.upload.open = true;*/
      },
      /** 下载模板操作 */
      importTemplate() {
        importTemplate().then(response => {
          this.download(response.msg);
        });
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
        this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
        this.upload.open = false;
        this.upload.isUploading = false;
        this.$refs.upload.clearFiles();
        this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
        this.getList();
      },
      // 提交上传文件
      submitFileForm() {
        this.$refs.upload.submit();
      },
    }
  };
</script>
